
var companies = {"000063":"中兴通讯","000066": "中国长城","000651":"格力电器","000768":"西飞国际","600320":"振华重工",
                 "601718":"东软集团",
                 "600839":"四川长虹","601390":"中国中铁","601766":"中国南车","601988":"中国银行"};
//绘制雷达图
function draw_radar(){
    var radar = echarts.init(document.getElementById('radar'),'dark');
    var option = {
        backgroundColor:['#1f2d3d'],

        title : {
            text: companies[stock_code]+"("+stock_code+")" +'近3个交易日综合评分',
            subtext:'综合评分' + (indexs[0]['zong_he']/11.0*100).toFixed(1),
            subtextStyle : {
            color :['#f59da6'],
            fontStyle :'normal',
            fontWeight :'bold',
            fontFamily :'sans-serif',
            fontSize :'16'
            },
            itemGap:20,
            padding:[0,15,15,15]
        },
        tooltip : {
            trigger: 'axis'
        },
        legend: {
            x : 'center',
            data:[indexs[0]['ri_qi'],indexs[1]['ri_qi'],indexs[2]['ri_qi']]  //此处为legend名字，须与series的data每个name相同
        },
        toolbox: {
            show : true,
            feature : {
                mark : {show: true},
                dataView : {show: true, readOnly: false},
                restore : {show: true},
                saveAsImage : {show: true}
            }
        },
        calculable : true,
        polar : [
            {
                indicator : [
                    {text : '资金', max  : 11},
                    {text : '强度', max  : 11},
                    {text : '风险', max  : 11},
                    {text : '转强', max  : 11},
                    {text : '长预', max  : 11},
                    {text : '近资', max  : 11}
                ],
                radius : 130
            }
        ],
        series : [
            {
                name: '各交易日数据对比',   //数据视图显示的标题
                type: 'radar',
                itemStyle: {
                    normal: {
                        areaStyle: {
                            type: 'default'
                        }
                    }
                },
                data : [
                    {
                        value : [9, 4, 8, 9, 9, 8],
                        name : '12-09',
                         //在拐点处显示数值
                        label: {
                            normal: {
                            show: true,
                            formatter: function(params){
                                return params.value
                               },
                            },
                        }
                    },
                    {
                        value : [9, 3, 7, 9, 8, 9],
                        name : '12-11',
                         label: {
                            normal: {
                            show: true,
                            formatter: function(params){
                                return params.value
                               },
                            },
                        }
                    },
                    {
                        value : [9, 3, 7, 9, 8, 9],
                        name : '12-12',
                         label: {
                            normal: {
                            show: true,
                            formatter: function(params){
                                return params.value
                               },
                            },
                        }
                    }
                ]
            }
        ]
    };

    for(var i = 0 ; i < 3;i++){
        option['series'][0]['data'][i]['value'] = [];
        option['series'][0]['data'][i]['value'].push(indexs[i]['zi_jin']);
        option['series'][0]['data'][i]['value'].push(indexs[i]['qiang_du']);
        option['series'][0]['data'][i]['value'].push(indexs[i]['feng_xian']);
        option['series'][0]['data'][i]['value'].push(indexs[i]['zhuan_qiang']);
        option['series'][0]['data'][i]['value'].push(indexs[i]['chang_yu']);
        option['series'][0]['data'][i]['value'].push(indexs[i]['jin_zi']);
        option['series'][0]['data'][i]['name'] = indexs[i]['ri_qi'];
    }
    radar.setOption(option);
}

if(indexs != null){
    draw_radar();
}